public class Test {
    public static void main(String[] args) {
        StringBuilder s1 = new StringBuilder("hello");
//        s1.setCharAt(1,'a');
//        System.out.println(s1.toString());

//        s1.insert(1,"kkk");
//        System.out.println(s1.toString());

//        s1.delete(1,3);
//        System.out.println(s1.toString());

//        s1.replace(1,3,"xxx");
//        System.out.println(s1.toString());

        s1.reverse();
        System.out.println(s1.toString());

    }
    public static void main5(String[] args) {
//        String s1 = "";
        StringBuilder s2 = new StringBuilder();
        int count = 10_0000;
        long startTime = System.currentTimeMillis();

//        for (int i = 0; i <count ; i++) {
//            s1 +=i;
//        }
        for (int i = 0; i <count ; i++) {
            s2.append(i);
        }
        long endTime = System.currentTimeMillis();
        System.out.println("时间: " + (endTime - startTime));
    }
    public static void main4(String[] args) {
        StringBuilder s1 = new StringBuilder("hello");
        s1.append(" world");
        System.out.println(s1);
    }
    public static void main3(String[] args) {
        String s = "hello";
        s += " world";
        System.out.println(s);
    }
    public static void main2(String[] args) {
        String s1 = "hello";
        char[] s2 = {'h','e','l','l','o'};
        String s3 = new String(s2);
        s3 = s3.intern();
        System.out.println(s1 == s3);
    }
    public static void main1(String[] args) {
        String s = "\t\t\t\t\t\t he llo \n\n\n\n\n";
        System.out.println(s.trim());
    }
}
